﻿using System;
using System.Collections.Generic;
using DataFiller.DataStorage.Holders;

namespace DataFiller.DataStorage.Regions
{
    public class DataRegion<T> : IDataRegion<T>
    {
        protected Dictionary<T, IDataRegion<T>> _Resgions;
        protected List<IDataHolder> _Records;

        public DataRegion()
        {
            _Records = new List<IDataHolder>();
        }

        #region IDataRegion Members

        public int ChildCount
        {
            get
            {
                return _Resgions == null ? 0 : _Resgions.Count;
            }
        }
        public List<IDataHolder> Records
        {
            get { return _Records; }
        }
        public virtual void AddChildRegion(T key, IDataRegion<T> child)
        {
            //if (_Resgions == null)
            //    _Resgions = new Dictionary<T, IDataRegion<T>>();
            //else if (_Resgions.ContainsKey(key))
            //    throw new ArgumentException(string.Format(Err.ExistingKey, key));

            //_Resgions.Add(key, child);
            throw new NotImplementedException();
        }
        public virtual void AddHolder(IDataHolder holder)
        {
            _Records.Add(holder);
        }
        #endregion

        protected class Err
        {
            public const string NoneExistingKey = "";
            public const string ExistingKey = "given key {0} is alread existing";
        }
    }
}
